package com.yc.booktable.controller;


import com.yc.booktable.entity.AdminUser;
import com.yc.booktable.service.IFeedbackService;
import com.yc.booktable.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author zbh
 * @since 2022-06-06
 */
@Controller
@RequestMapping("/feedback")
public class FeedbackController {
    @Resource
    private IFeedbackService feedbackService;

    @PostMapping("back")
    @ResponseBody
    public Result back(String message, HttpSession session){
        AdminUser user = (AdminUser) session.getAttribute("loginedUser");
        Result add = feedbackService.add(message, user.getId());
        return add;
    }


}

